package com.user.controller;

import com.common.utils.Result;
import com.user.pojo.dto.UserDto;
import com.user.server.UserServer;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
@Api(tags = "用户相关接口")
public class UserControll {

    @Autowired
    private UserServer userServer;

    @PostMapping("/insert")
    @ApiOperation(value = "新增用户")
    public Result insertUser(@RequestBody UserDto userDto){
       return userServer.newUser(userDto);
    }

    @GetMapping("/detail/{userId}")
    @ApiOperation(value = "查询用户详细信息")
    public Result selectUserDetail(@PathVariable long userId){
        return userServer.selectUserDetail(userId);
    }

    @DeleteMapping("/delete/{userId}")
    public Result deleteUser(@PathVariable long userId){
      return  userServer.deleteUser(userId);
    }
}
